<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>自定义右键菜单</title>
    <style>
        
    </style>
</head>
<body>
    <script>

        let DataStore = function() {
            this.catch = {}
        }

        DataStore.prototype.put = function(key, v) {
            this.catch[key] = v;
        }
        DataStore.prototype.get = function(key) {
            return this.catch[key];
        }
        DataStore.prototype.del = function(key) {
            delete this.catch[key];
            return true;
        }

        DataStore.put(new 飞镖)
        DataStore.del(飞镖)

        // 登录悬浮窗
        var LoginWindow = function() {
            this.username = ''
            this.pwd = ''
            this.instance = null
        }
        // 静态单例方法，不会被继承
        LoginWindow.getInstance = function() {
            this.instance = this.instance || new LoginWindow()
            return this.instance
        }

        let l_1 = LoginWindow.getInstance();
        let l_2 = LoginWindow.getInstance();
        console.log(l_1 === l_2); // true
    </script>
</body>
</html>